/*
* name;
*/
class GameManager {
    public static Instance: GameManager;
    public MainUIInstance: MainUILogic;
    public LevelUIInstance: LevelUILogic;

    constructor() {
        //实例UI界面
        this.MainUIInstance = new MainUILogic();
        this.LevelUIInstance = new LevelUILogic();
        this.ShowMainUI();
    }
    private HideAllUI(): void {
        Laya.stage.removeChild(this.MainUIInstance);
        Laya.stage.removeChild(this.LevelUIInstance);
    }
    public ShowMainUI(): void {
        this.HideAllUI();
        this.MainUIInstance.InitUI();
        Laya.stage.addChild(this.MainUIInstance);

    }
    public ShowLevelUI(): void {
        this.HideAllUI();
        this.LevelUIInstance.InitUI();
        Laya.stage.addChild(this.LevelUIInstance);

    }

}

let resList = [
    "res/atlas/CommonUI.atlas",
    "res/atlas/MainUI.atlas",
    "res/atlas/LevelUI.atlas"
]
//初始化微信小游戏
Laya.MiniAdpter.init();
//程序入口
Laya.init(1080, 1920, Laya.WebGL);
Laya.stage.scaleMode = laya.display.Stage.SCALE_FIXED_AUTO;
Laya.stage.screenMode = "vertical";
//激活资源版本控制
Laya.ResourceVersion.enable("version.json", Laya.Handler.create(null, beginLoad), Laya.ResourceVersion.FILENAME_VERSION);
function beginLoad() {
    Laya.loader.load(resList, Laya.Handler.create(null, onLoaded));
}

function onLoaded(): void {
    GameManager.Instance = new GameManager();
}


